<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <title>Title</title>
</head>
<body>


<button id="button1" onclick="f()">aaa</button>
<input type="checkbox" name="op" value="1">
<input type="checkbox" name="op" value="2">
<input type="checkbox" name="op" value="3">
<script type="application/javascript">
    function f() {
        const op = document.getElementsByName('op');
        console.log(op);
        const lists = new FormData
        for (let i = 0; i < op.length; i++) {
            if (op[i].checked)
                lists.append('hosts',op[i].value);
                lists.append('sc',op[i].value);
                console.log(lists);
        }
        const xhr = new XMLHttpRequest();
        xhr.open('POST', 'http://localhost:5000/runscript');
        xhr.send(lists);
    }


</script>
</body>
</html>